<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="keywords" content="<?php echo $keywords ?>">
    <meta name="description" content="<?php echo $description ?>">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title><?php echo $title; ?></title>
    <link rel="shortcut icon" href="/favicon.ico">
    <script src="/static/js/jquery-3.1.1.min.js"></script>
    <script src="/static/js/bootstrap.min.js"></script>
    <link rel="stylesheet" type="text/css" href="/static/css/font-awesome.min.css">
    <link rel="stylesheet" type="text/css" href="/static/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/static/css/common.css">
</head>
<body>

<header class="">
  <nav class="navbar navbar-default navbar-fixed-top" role="navigation">
    <div class="container">
      <div class="navbar-header page-scroll">
        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
          <span class="sr-only"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="/" title="<?php echo $site['title']; ?>"><?php echo $site['title']; ?></a>
      </div>
      <div class="collapse navbar-collapse" id="navbar">
        <form class="navbar-form navbar-right" action="/search" onsubmit="return checkForm(this)">
          <div class="input-group">
            <input type="text" class="form-control" placeholder="Search for..." name="keywords" value="<?php echo $word ?? '' ?>">
            <span class="input-group-btn">
              <button class="btn btn-default" type="submit">搜索</button>
            </span>
          </div>
        </form>
      </div>
    </div>
  </nav>
</header>

<div class="container left-block hidden-xs">
  <div class="row">
    <div class="col-md-2">
      <div class="tag-list m-h bg-white">
        <?php
        $idx  = 0;
        $temp = $data['tag_list'];
        foreach ($temp as $tid => $tag) {
          if ($idx == 0) {
            echo '<a href="/tag/' . $tid . '" class="blod">' . $tag . '</a><div class="border-bottom m-h"></div>';
          } else {
            echo '<a href="/tag/' . $tid . '">' . $tag . '</a>';
          }
          $idx++;
        }
        ?>
      </div>
    </div>
  </div>
</div>
<div class="container mt-header">
  <div class="row">
    <div class="col-md-8 col-md-offset-2 border-left">
      <div class="bg-muted">
        <!--内容-->
        <?php
        if (count($data['list'])) {
          $lable_colour = ['info', 'success', 'danger', 'primary', 'warning'];
          foreach ($data['list'] as $index => $question) {
            $tag_list = '';
            foreach ($question['tags'] as $idx => $q_tag) {
              if (isset($data['tag_list'][$q_tag])) {
                $tag_list .= '<span class="label label-' . $lable_colour[array_rand($lable_colour)] . '">' . $data['tag_list'][$q_tag] . '</span>';
              }
            }
            echo <<<EOT
<div class="faq-item">
          <div class="row">
            <div class="col-md-10">
              <a href="/a/{$question['question_id']}" class="faq-question">{$question['title']}</a>
              <span class="tag-list">{$tag_list}
                <span class="text-muted"><i class="fa fa-clock-o"></i>&nbsp;{$question['created_at']}</span>
              </span>
            </div>
            <div class="col-md-2">
              <span class="small font-bold pr">{$question['user']}</span>
            </div>
          </div>
        </div>
EOT;
          }
        } else {
          echo '<div class="flex-column-center"><svg xmlns="http://www.w3.org/2000/svg" id="no-ressult" data-name="Layer 1" viewBox="0 0 256 256"><defs><style>.cls-1{fill:#f3f8fc;}.cls-2{fill:#ffb935;}.cls-3{fill:#cceaff;}.cls-4,.cls-5{fill:none;stroke-miterlimit:10;stroke-width:2px;}.cls-4{stroke:#1060e1;}.cls-5{stroke:#f48024;}.cls-6{fill:#fff;}</style></defs><title>Artboard 50 copy 7</title><circle class="cls-1" cx="138.02" cy="138.81" r="90.96"/><circle class="cls-2" cx="118.18" cy="124.65" r="68.5"/><rect class="cls-3" x="207.96" y="189.98" width="23.44" height="52.96" transform="translate(-88.72 218.73) rotate(-45)"/><rect class="cls-4" x="199.96" y="189.98" width="23.44" height="52.96" transform="translate(-91.06 213.08) rotate(-45)"/><path class="cls-5" d="M83.38,155.69m84.31,16.78,25.25,25.29M29.36,115.17a81,81,0,1,0,81-81A81,81,0,0,0,29.36,115.17Z"/><circle class="cls-5" cx="110.36" cy="115.14" r="67.42"/><path class="cls-2" d="M226.52,114.06a2.83,2.83,0,0,1-1.91-.78,2.52,2.52,0,0,1-.57-.89,2.75,2.75,0,0,1-.22-1,3.71,3.71,0,0,1,.06-.54,1.81,1.81,0,0,1,.16-.48,1.35,1.35,0,0,1,.24-.46,5.36,5.36,0,0,1,.33-.43,2.81,2.81,0,0,1,3.82,0,5.34,5.34,0,0,1,.32.43,1.58,1.58,0,0,1,.25.46,1.48,1.48,0,0,1,.15.48,3.71,3.71,0,0,1,.06.54,2.74,2.74,0,0,1-.21,1,2.66,2.66,0,0,1-.57.89,2.86,2.86,0,0,1-1.91.78"/><path class="cls-2" d="M215.75,114.06a2.18,2.18,0,0,1-1-.22,3.05,3.05,0,0,1-.88-.56,2.66,2.66,0,0,1-.57-.89,2.75,2.75,0,0,1-.22-1,2.81,2.81,0,0,1,.79-1.91,3.09,3.09,0,0,1,.88-.57,2.71,2.71,0,0,1,1.57-.16,2.15,2.15,0,0,1,.49.16,1.79,1.79,0,0,1,.47.25l.41.32a2.86,2.86,0,0,1,.79,1.91,2.75,2.75,0,0,1-.22,1,2.66,2.66,0,0,1-.57.89c-.14.11-.27.24-.41.33a2,2,0,0,1-.47.23,1.79,1.79,0,0,1-.49.17,4.93,4.93,0,0,1-.54,0"/><path class="cls-2" d="M215.75,103.29a2.29,2.29,0,0,1-1-.21,3.55,3.55,0,0,1-.88-.56,2.71,2.71,0,0,1-.57-.9,2.75,2.75,0,0,1-.22-1,2.81,2.81,0,0,1,.79-1.91,3.09,3.09,0,0,1,.88-.57,2.71,2.71,0,0,1,1.57-.16,2.15,2.15,0,0,1,.49.16,1.79,1.79,0,0,1,.47.25l.41.32a2.86,2.86,0,0,1,.79,1.91,2.75,2.75,0,0,1-.22,1,2.71,2.71,0,0,1-.57.9c-.14.1-.27.23-.41.32a2.61,2.61,0,0,1-.47.24,2.15,2.15,0,0,1-.49.16,4.93,4.93,0,0,1-.54.05"/><path class="cls-2" d="M226.52,103.29a2.66,2.66,0,0,1-2.7-2.69,2.7,2.7,0,0,1,4.61-1.91,2.85,2.85,0,0,1,.78,1.91,2.65,2.65,0,0,1-2.69,2.69"/><path class="cls-2" d="M226.52,124.83c-.17,0-.35,0-.54,0a1.59,1.59,0,0,1-.49-.17,2.32,2.32,0,0,1-.48-.23c-.13-.12-.26-.22-.4-.33a2.93,2.93,0,0,1-.57-.89,2.75,2.75,0,0,1-.22-1,3.31,3.31,0,0,1,.06-.54,1.81,1.81,0,0,1,.16-.48,1.85,1.85,0,0,1,.24-.49l.33-.4a2.81,2.81,0,0,1,3.82,0l.32.4a2.27,2.27,0,0,1,.25.49,1.48,1.48,0,0,1,.15.48,3.31,3.31,0,0,1,.06.54,2.74,2.74,0,0,1-.21,1,3.14,3.14,0,0,1-.57.89l-.41.33a1.92,1.92,0,0,1-.48.23,1.63,1.63,0,0,1-.48.17c-.19,0-.38,0-.54,0"/><path class="cls-2" d="M215.75,124.83a2.61,2.61,0,0,1-1-.22,3.05,3.05,0,0,1-.88-.56,3,3,0,0,1-.79-1.91,2.81,2.81,0,0,1,.79-1.91,3.09,3.09,0,0,1,.88-.57,2.71,2.71,0,0,1,1.57-.16,1.75,1.75,0,0,1,.49.16,1.79,1.79,0,0,1,.47.25l.41.32a2.86,2.86,0,0,1,.79,1.91,3,3,0,0,1-.79,1.91c-.14.11-.27.24-.41.33a2,2,0,0,1-.47.23,1.79,1.79,0,0,1-.49.17,4.93,4.93,0,0,1-.54,0"/><path class="cls-2" d="M215.75,135.6a2.61,2.61,0,0,1-1-.22,3.05,3.05,0,0,1-.88-.56,3.14,3.14,0,0,1-.57-.89,2.75,2.75,0,0,1-.22-1,2.49,2.49,0,0,1,.07-.53,1.41,1.41,0,0,1,.15-.48,2.22,2.22,0,0,1,.24-.49l.33-.4a3.09,3.09,0,0,1,.88-.57,2.71,2.71,0,0,1,1.57-.16,1.75,1.75,0,0,1,.49.16,1.79,1.79,0,0,1,.47.25l.41.32.32.4a1.89,1.89,0,0,1,.25.49,1.41,1.41,0,0,1,.15.48,3.35,3.35,0,0,1,.07.53,2.75,2.75,0,0,1-.22,1,3.14,3.14,0,0,1-.57.89l-.41.32a1.74,1.74,0,0,1-.47.24,1.79,1.79,0,0,1-.49.17,4.93,4.93,0,0,1-.54,0"/><path class="cls-2" d="M215.75,92.52a2.66,2.66,0,0,1-2.7-2.69,3,3,0,0,1,.79-1.91,3.09,3.09,0,0,1,.88-.57,2.63,2.63,0,0,1,3.51,1.46,2.79,2.79,0,0,1,.22,1,2.9,2.9,0,0,1-.79,1.92c-.14.1-.27.24-.41.32a2.61,2.61,0,0,1-.47.24,2.15,2.15,0,0,1-.49.16,4.93,4.93,0,0,1-.54,0"/><path class="cls-2" d="M215.75,81.76a2.68,2.68,0,0,1-2.7-2.7,3,3,0,0,1,.79-1.91,3.32,3.32,0,0,1,.88-.57,2.62,2.62,0,0,1,1.57-.15,2.09,2.09,0,0,1,.49.15,2.15,2.15,0,0,1,.47.25c.14.08.27.22.41.32a3,3,0,0,1,.79,1.91,2.9,2.9,0,0,1-.79,1.92c-.14.1-.27.24-.41.32a2.09,2.09,0,0,1-.47.24,2.15,2.15,0,0,1-.49.16,5,5,0,0,1-.54.06"/><path class="cls-2" d="M215.75,146.37a2.61,2.61,0,0,1-1-.22,3.05,3.05,0,0,1-.88-.56,3.14,3.14,0,0,1-.57-.89,2.75,2.75,0,0,1-.22-1,2.67,2.67,0,0,1,.07-.54,1.43,1.43,0,0,1,.15-.47,2.22,2.22,0,0,1,.24-.49l.33-.4a3.09,3.09,0,0,1,.88-.57,2.71,2.71,0,0,1,1.57-.16,1.75,1.75,0,0,1,.49.16,2.09,2.09,0,0,1,.47.24l.41.33.32.4a1.89,1.89,0,0,1,.25.49,1.43,1.43,0,0,1,.15.47,3.64,3.64,0,0,1,.07.54,2.75,2.75,0,0,1-.22,1,3.14,3.14,0,0,1-.57.89l-.41.32a1.74,1.74,0,0,1-.47.24,2.21,2.21,0,0,1-.49.17,4.93,4.93,0,0,1-.54.05"/><path class="cls-2" d="M205,103.29a2.88,2.88,0,0,1-1.91-.77,3,3,0,0,1-.57-.9,2.47,2.47,0,0,1,0-2,3.14,3.14,0,0,1,.57-.89,2.73,2.73,0,0,1,2.45-.73,2,2,0,0,1,.49.16,1.79,1.79,0,0,1,.47.25c.14.08.27.22.41.32a2.63,2.63,0,0,1,.57,2.93,2.71,2.71,0,0,1-.57.9c-.14.1-.27.23-.41.32a2.61,2.61,0,0,1-.47.24,2,2,0,0,1-.49.16,4.93,4.93,0,0,1-.54.05"/><path class="cls-2" d="M205,124.83a2.85,2.85,0,0,1-1.91-.78,3.14,3.14,0,0,1-.57-.89,2.75,2.75,0,0,1-.22-1,2.86,2.86,0,0,1,.79-1.91,2.73,2.73,0,0,1,2.45-.73,1.65,1.65,0,0,1,.49.16,1.79,1.79,0,0,1,.47.25,3.81,3.81,0,0,1,.41.32,2.81,2.81,0,0,1,.79,1.91,3,3,0,0,1-.79,1.91l-.41.33a2,2,0,0,1-.47.23,1.69,1.69,0,0,1-.49.17,4.93,4.93,0,0,1-.54,0"/><path class="cls-2" d="M205,81.76a2.89,2.89,0,0,1-1.91-.78,3.14,3.14,0,0,1-.57-.89,2.84,2.84,0,0,1-.22-1,2.79,2.79,0,0,1,.22-1,3.14,3.14,0,0,1,.57-.89,2.7,2.7,0,0,1,2.45-.72,2,2,0,0,1,.49.15,2.15,2.15,0,0,1,.47.25c.14.08.27.22.41.32a3,3,0,0,1,.79,1.91,2.84,2.84,0,0,1-.22,1,2.77,2.77,0,0,1-.57.89c-.14.1-.27.24-.41.32a2.09,2.09,0,0,1-.47.24,2,2,0,0,1-.49.16,5,5,0,0,1-.54.06"/><path class="cls-2" d="M205,146.37a2.85,2.85,0,0,1-1.91-.78,3.14,3.14,0,0,1-.57-.89,2.75,2.75,0,0,1-.22-1,3.64,3.64,0,0,1,.07-.54,1.43,1.43,0,0,1,.15-.47,2.22,2.22,0,0,1,.24-.49,3.87,3.87,0,0,1,.33-.4,2.68,2.68,0,0,1,2.45-.73,1.65,1.65,0,0,1,.49.16,2.09,2.09,0,0,1,.47.24c.14.09.27.22.41.33a2.78,2.78,0,0,1,.79,1.9,2.75,2.75,0,0,1-.22,1,3.14,3.14,0,0,1-.57.89l-.41.32a1.74,1.74,0,0,1-.47.24,2,2,0,0,1-.49.17,4.93,4.93,0,0,1-.54.05"/><path class="cls-6" d="M106.58,113.47l.34-.34c9.08-.21,14.31-4.41,14.31-11V102c0-5.64-4.4-10.38-11.42-10.38-5.5,0-9.7,2.68-13.28,7.08l-2.47-2.06c3.92-4.89,8.6-8.19,15.89-8.19,9.08,0,14.92,6,14.92,13.41V102c0,8.53-6.6,13.07-14.58,14l-.62,8.6h-2.2Zm-.28,17.88h4.54v5.85H106.3Z"/></svg><h3 class="text-center">' . ($keywords ?? '') . ' 没有相关内容</h3><h5 class="text-center p-h">换个词试试?</h5></div>';
        }
        ?>
        <!--分页-->
        <div class="text-center m-h bg-white">
          <nav aria-label="Page navigation">
            <ul class="pagination">
              <?php
              if ($count > 0) {
                if ($current == 1) {
                  echo '<li class="disabled"><a href="javascript:" aria-label="Previous"><span aria-hidden="true">上一页</span></a></li>';
                } else {
                  echo '<li><a href="' . $url . ($current - 1) . '" aria-label="Previous"><span aria-hidden="true">上一页</span></a></li>';
                }
                $prelock  = true;
                $lastlock = true;
                for ($i = 1, $l = $count + 1; $i < $l; $i++) {
                  $str = '';
                  if ($i == $current) {
                    $str .= '<li class="active"><a href="javascript:">' . $i . '</a></li>';
                  } else if ($count < 10) {
                    $str .= '<li><a href="' . $url . $i . '">' . $i . '</a></li>';
                  } else {
                    if ($i < 4 || $i > ($l - 2) || $i == $current + 1 || $i == $current - 1) {
                      $str .= '<li><a href="' . $url . $i . '">' . $i . '</a></li>';
                    } elseif ($i == $current - 2 && $prelock) {
                      $str     = '<li><span>…</span></li>';
                      $prelock = false;
                    } elseif ($i == $current + 2 && $lastlock) {
                      $str      = '<li><span>…</span></li>';
                      $lastlock = false;
                    } elseif ($prelock && $lastlock) {
                      $str     = '<li><span>…</span></li>';
                      $prelock = false;
                    }
                  }
                  echo $str;
                }

                if ($current == $count) {
                  echo '<li class="disabled"><a href="javascript:" aria-label="Next"><span aria-hidden="true">下一页</span></a></li>';
                } else {
                  echo '<li><a href="' . $url . ($current + 1) . '" aria-label="Next"><span aria-hidden="true">下一页</span></a></li>';
                }
              }
              ?>
            </ul>
          </nav>
        </div>
      </div>
    </div>

    <div class="col-md-2">
      <!--
      <div>
        <ul class="list-group">
          <li class="adv-box">
            <small class="adv-close">广告×</small>
            <a href="https://www.baidu.com">
              <img
                src=""
                alt="adv" class="img-responsive">
            </a>
          </li>
        </ul>
      </div>
      -->
      <!--TODO advertising-->
    </div>
  </div>
</div>
<div class="footer">
  <!--  TODO footer-->
</div>

<?php $this->include('layouts/default/footer') ?>
